<template>
  <div class="item" @click="toSheet">
    <div class="box">
      <img :src="item.playlist.coverImgUrl" alt="" />
      <ol>
        <li
          v-for="(top, index) in item.playlist.tracks.slice(0, 3)"
          :key="index"
        >
          {{ top.name }}-
          <span v-for="(art, i) in top.ar" :key="art.id"
            >{{ art.name }}
            <span v-if="i != top.ar.length - 1"
              >/</span
            ></span
          >
        </li>
      </ol>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    item: { type: Object },
  },
  methods:{
    toSheet(){
      console.log(this.item);
      this.$router.push({path:"/musicsheet",query:{id:this.item.playlist.id}})
    }
  }
};
</script>
<style lang="scss" scoped>
.item {
  box-sizing: border-box;
  .box {
    width: 100%;
    display: flex;
    padding: 10px;
    box-sizing: border-box;
    border-bottom: 1px solid #ccc;
    > img {
      width: 70px;
    }
    ol {
      counter-reset: sectioncounter;
      display: flex;
      flex-grow: 1;
      flex-direction: column;
      justify-content: space-evenly;
      padding-left: 20px;
 overflow: hidden;
      li {
        width: 90%;
        flex-direction: column;
        font-size: 14px;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
        &::before {
          display: inline-block;
          content: counter(sectioncounter) ".";
          counter-increment: sectioncounter;
        }
      }
    }
  }
}
</style>